import { defineStore } from 'pinia'

import { getDishes } from '../api/listApi';

const useListStore = defineStore('listStore', {
  state() {
    return {
      list: [] as Datum[],
    }
  },

  actions: {
    async loadData() {
      const res = await getDishes() 
      this.list=res.data
      console.log(this.list)

    }
  },


  getters: {
    filteredList() {
      return (amount:number) => {
        return this.list.slice(0, amount)
      }
    }
  }
})

export default useListStore